package cn.wolfcode.MyEnum;

import lombok.Getter;

@Getter
public enum NoticeEnum {
    URGENCY("紧急", 0),
    IMPORTANCE("重要", 1),
    COMMON("普通", 2);


    private String name;
    private Integer value;

    NoticeEnum(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    //提供一个根据value 获取名字的方法
    public static String findName(Integer value) {
        NoticeEnum[] values = NoticeEnum.values();
        for (NoticeEnum a :
                values) {
            if (a.getValue().equals(value)) {
                return a.getName();
            }
        }
        return null;
    }
}
